﻿using EntityModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Linq;

namespace PartyWorkSupervise.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class EmployeeController : ControllerBase
    {
        private readonly PWSDBContext db;
        public EmployeeController(PWSDBContext context)
        {
            db = context;
        }

        [HttpGet]
        public Result Employee()
        {
            Result result = new Result();
            var resulrData = db.EM_Employee.ToList<EM_Employee>();
            result.Data = resulrData;
            result.Supervisor = "1234567@qq.com";
            result.Code = 200;
            return result;
        }

        //[HttpGet]
        //public Result Employee(int Postion)
        //{
        //    Result result = new Result();
        //    EM_People? people = db.EM_People.Where(s=> Postion='党务人员').SingleOrDefault();
        //    result.Data = people;
        //    result.Supervisor = "1234567@qq.com";
        //    result.Code = people == null ? 404 : 200;
        //    return result;
        //}
    }
}
